package com.cloudsigns.factorymanager2.project.activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.project.adapter.DesignContactOrderListAdapter1;
import com.cloudsigns.factorymanager2.project.bean.DesignTypeBean;
import com.cloudsigns.factorymanager2.project.myinerface.ItemClickListener;

import java.util.ArrayList;
import java.util.List;

public class DesignContactOrderListActivity1 extends Activity implements View.OnClickListener  {
    private RelativeLayout rl_right;
    private ImageView img_back;
    private TextView tv_title;
    private ListView lv;
    private DesignContactOrderListAdapter1 adapter;
    private List<DesignTypeBean> designTypeBeanList = new ArrayList<>();

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);//去掉标题栏
        // 沉浸式状态栏
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS
                    );
            window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN

                    | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
            window.setStatusBarColor(Color.TRANSPARENT);

        } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
        }
        setContentView(R.layout.layout_design_contact_order_list1);

        init();

        lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
                Intent mIntent;
                mIntent=new Intent(DesignContactOrderListActivity1.this,DesignContactOrderListItemActivity.class);
                startActivity(mIntent);
            }
        });
    }

    private void init(){
        img_back = findViewById(R.id.img_back);
        rl_right = findViewById(R.id.rl_right);
        tv_title = findViewById(R.id.tv_title);
        lv=findViewById(R.id.lv);

        tv_title.setText("工艺/设计");
        img_back.setOnClickListener(this);
        rl_right.setOnClickListener(this);

        designTypeBeanList.add(new DesignTypeBean("设计类型", false, 0));
        designTypeBeanList.add(new DesignTypeBean("设计类型", false, 1));
        adapter = new DesignContactOrderListAdapter1(this);
        adapter.setData(designTypeBeanList);
        lv.setAdapter(adapter);
    }

    @Override
    public void onClick(View view) {
        Intent mIntent;
        switch (view.getId()) {
            // 返回
            case R.id.img_back:
                finish();
                break;
                // 更多
            case R.id.rl_right:
                mIntent=new Intent(DesignContactOrderListActivity1.this,DesignContactOrderActivity1.class);
                startActivity(mIntent);
                break;
        }
    }


}
